<?php
/*myorder.html*/
/*以JSON格式向客户端的指定电话号码所下的所有订单*/
header('Content-Type: application/json;charset=UTF-8');

@$phone = $_REQUEST['phone'];
if( !isset($phone) ){
    echo '[]'; //客户端未提交phone
    return;
}

$conn = mysqli_connect('127.13.30.2','admin3R8pGpB','Vd8yi-7fciGM','wytweb');
$sql = 'SET NAMES utf8';
mysqli_query($conn, $sql);

$sql = "SELECT oid,user_name,order_time,name,img_sm, kf_dish.did FROM kf_dish, kf_order WHERE kf_dish.did=kf_order.did  AND phone='$phone'";
$result = mysqli_query($conn, $sql);

$orderList = [];
while( $row = mysqli_fetch_assoc($result) ){
    $orderList[] = $row;
}

//把PHP数组编码为JSON字符串,并输出给客户端
echo json_encode($orderList);
?>